#!/usr/bin/env bash

cd ${PATH_NAME_01}
TAG_BEGIN=111
TAG_END=444
DIR_NAME_PACKAGES=packages
ZIP_FILE_NAME=package.zip
DIR_NAME_UNZIP_PACKAGE=unzip-package

PATH_DIR_PACKAGES=${PATH_NAME_01}/${DIR_NAME_PACKAGES}
PATH_ZIP_FILE=${PATH_DIR_PACKAGES}/${ZIP_FILE_NAME}
mkdir ${PATH_DIR_PACKAGES}
PATH_DIR_UNZIP_PACKAGE=${PATH_DIR_PACKAGES}/${DIR_NAME_UNZIP_PACKAGE}
mkdir ${PATH_DIR_UNZIP_PACKAGE}

PATH_LIST=$(git diff ${TAG_BEGIN}...${TAG_END} --name-only)
git archive -o ${PATH_ZIP_FILE} HEAD ${PATH_LIST}

unzip -o -d ${PATH_DIR_UNZIP_PACKAGE} ${PATH_ZIP_FILE} 